<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let year = +prompt('输入年份')
    let month = +prompt('输入月份')
    let day

    if (month === 2) {
      if (year % 400 === 0 || year % 4 === 0 && year % 100) {
        day = 29
      } else {
        day = 28
      }
    } else if (month === 4 || month === 6 || month === 9 || month === 11) {
      day = 30
    } else {
      day = 31
    }
    alert(`${year}年${month}月有${day}天`)
  </script>
</body>

</html>